<%@page import="entity.Goods"%>
<%@page import="dao.GoodDetailDao"%>
<%@page import="entity.OrderItem"%>
<%@page import="java.util.ArrayList"%>
<%@page import="entity.Order"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>已买到的宝贝</title>
<link rel="stylesheet" href="<%=basePath%>css/bootstrap.css" type="text/css" />
<link rel="stylesheet" type="text/css" href="<%=basePath%>css/MyOrder.css"/>
</head>
<body>
	<%
	List<Order> orderList=(List)session.getAttribute("orders");
	%>
	<jsp:include page="header_htl_2.jsp"></jsp:include>
	<div class="left">
    	<table class="menulist">
			 		<tr>
				<td><input type="button" value="我的购物车"/></td></tr><br />
			<tr><td><input type="button" value="已买到的宝贝" onclick="changeIframe()"/></td></tr>  	
    	</table>
    	</div>
    	<div class="box">
    	<div class="content">
    		<span><input type="button" value="所有订单" id="allOrder"/></span>
    		<span><input type="button" value="待付款" id="waitPay"/></span>
    		<span><input type="button" value="待发货" id="waitSend"/></span>
    		<span><input type="button" value="待收货" id="waitAccept"/></span>
    		<span><input type="button" value="成为商家" id="becomeBusiness"/></span>
    	</div>
    	<div class="o_content">
    		<table id="goodlist" class="table table-striped" >
    			<tr class="tr1">
				<th>下单时间</th>
				<th>订单号</th>
				<th>商品名字</th>
				<th>商品详情</th>
				<th>商品价格</th>
				<th>商品数量</th>
				<th>商品总价</th>
				<th>订单状态</th>
				<th>订单详情</th>
			</tr>
			
			<% 
			for(int i=0;i<orderList.size();i++){ 
				for(int j=0; j<orderList.get(i).getOrderItem().size(); j++) { %>
    			<tr>
    				<td><%=orderList.get(i).startTimeFormat() %></td>
    				<td id="tdOrderId"><%=orderList.get(i).getOrderId() %></td>
    				<td>
    					<a href="becomeBusiness.jsp"><%=orderList.get(i).getOrderItem().get(j).getGoods().getGoodName() %></a></td>
    				<td><a href="becomeBusiness.jsp"><%=orderList.get(i).getOrderItem().get(j).getGoods().getGoodInfo() %></a></td>
    				<td><%=orderList.get(i).getOrderItem().get(j).getGoods().getGoodPrice() %></td>
    				<td><%=orderList.get(i).getOrderItem().get(j).getGoodNumber() %></td>
    				<td><%=orderList.get(i).getOrderItem().get(j).getTotal_price() %></td>
    				<td><%=orderList.get(i).getOrderStatus() %></td>
    				<td><button onclick="myselfinfo(this)" id="btn">查看详情</button></td>
    			</tr>
    			<% }} %> 
    		</table>
    	</div>
    </div>
    	<iframe name="buttom" marginwidth=0 scrolling="no" marginheight=0
			width=100% height=120 src="buttom_htl.html" frameborder=0 class="bottom"></iframe>
    	<script type="text/javascript" src="<%=basePath%>js/jquery-3.2.1.min.js" ></script>
    	<script type="text/javascript" src="<%=basePath%>js/wait_pay_content.js" ></script>
    	<script type="text/javascript" src="<%=basePath%>lib/layer/2.4/layer.js"></script>
    	<script>
    	function myselfinfo(obj){
    		var orderId = $(obj).parent().parent().children(":eq(1)").html();
    		var index = layer.open({
    			type: 2,
    			area: ['800px','400px'],
    			fix: ['50px','50px'], //不固定
    			maxmin: true,
    			title: '查看信息',
    			content: 'OrderDescServlet?orderId='+orderId,
    		});
    		layer.full(index);
    		
    	}
    	</script>
		
</body>
</html>